
export const buttonShow = function(_that, formcode, formid) {
	return _that.om.request("wxPosBusiAuth/newToolTotal", {
		businessFormCode: formcode,
		fileId: formid
	}).then(res => {
		return new Promise((resolve, reject) => {
			if (res.value) {
				let buttons = [];
				// if (res.value.isedit) {
				// 	buttons.push({
				// 		func: "send",
				// 		text: "发送"
				// 	});
				// 	buttons.push({
				// 		func: "remove",
				// 		text: "删除"
				// 	});
				// }
				if (res.value.issend) {
					buttons.push({
						func: "send",
						text: "发送"
					});
				}
				if (res.value.isdelete) {
					buttons.push({
						func: "remove",
						text: "删除"
					});
				}
				if (res.value.isdissend) {
					buttons.push({
						text: "取回",
						func: "dissend"
					});
				}
				if (res.value.ischeck) {
					let btn = {
						text: "审核",
						func: "getTip",
						chUrl:res.value.chUrl,
						changeNodeOn:res.value.changeNodeOn,
						changeNodeRequired:res.value.changeNodeRequired,
						flowConfigNodeId:res.value.flowConfigNodeId,
						needHandSign:res.value.needHandSign
					};
					let approver = res.value.approver
					if(approver){
						btn.backAbleFlag = approver.backAbleFlag
						btn.parallelFlag = approver.parallelFlag
						btn.abstainFlag = approver.abstainFlag
					}
					buttons.push(btn);
				}
				if (res.value.isuncheck) {
					buttons.push({
						text: "弃核",
						func: "disexamine"
					});
				}
				if (res.value.isapprove) {
					let btn = {
						text: "审批",
						func: "approve",
						changeApprover:res.value.changeApprover,
						cancelAble:res.value.cancelAble,
						needHandSign:res.value.needHandSign
					};
					let approver = res.value.approver
					if(approver){
						btn.backAbleFlag = approver.backAbleFlag
					}
					buttons.push(btn);
				}
				
				if (res.value.ish5Edit) {
					buttons.push({
						text: "修改",
						func: "edit",
						edUrl:res.value.edUrl
					});
				}
				if (res.value.isCheckEdit) {
					buttons.push({
						text: "修改",
						func: "checkedit",
						ceUrl:res.value.ceUrl
					});
				}
				if (res.value.isdisapprove) {
					buttons.push({
						text: "弃批",
						func: "disapprove",
						ceUrl:res.value.ceUrl
					});
				}
				resolve(buttons)
			} else {
				reject()
			}
		})
	})
}
